# -*- coding: utf-8 -*-
# time: 2025/5/14 11:58
# file: img_text.py
# author: hanson
"""
https://www.langchain.com.cn/docs/how_to/document_loader_pdf/
pip install -qU langchain-unstructured
需要apikey
"""

from langchain_unstructured import UnstructuredLoader

loader = UnstructuredLoader(
    file_path=r"C:\Users\Administrator\Downloads\封面.png",
    strategy="hi_res",
    partition_via_api=True,
    coordinates=True,
)
docs = []
for doc in loader.lazy_load():
    docs.append(doc)

print(f"{docs[0].metadata}\n")
content = docs[0].page_content